package edu.unf.cen6940.service;

import edu.unf.cen6940.domain.Faculty;
import edu.unf.cen6940.domain.Facultyresearch;
import edu.unf.cen6940.domain.Facultyresearchtostudent;
import edu.unf.cen6940.domain.Student;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/rms_test-security-context.xml",
		"file:./resources/rms_test-service-context.xml",
		"file:./resources/rms_test-dao-context.xml",
		"file:./resources/rms_test-web-context.xml" })
@Transactional
public class FacultyresearchtostudentServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected FacultyresearchtostudentService service;

	/**
	 * Instantiates a new FacultyresearchtostudentServiceTest.
	 *
	 */
	public FacultyresearchtostudentServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Student entity
	 * 
	 */
	@Test
	public void deleteFacultyresearchtostudentStudent() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyresearchtostudentStudent 
		Integer facultyresearchtostudent_facultyResearchId = 0;
		Integer facultyresearchtostudent_studentId = 0;
		Integer facultyresearchtostudent_facultyId = 0;
		Integer related_student_studentId = 0;
		Facultyresearchtostudent response = null;
		response = service.deleteFacultyresearchtostudentStudent(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, related_student_studentId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyresearchtostudentStudent
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Facultyresearch entity
	 * 
	 */
	@Test
	public void deleteFacultyresearchtostudentFacultyresearch() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyresearchtostudentFacultyresearch 
		Integer facultyresearchtostudent_facultyResearchId_1 = 0;
		Integer facultyresearchtostudent_studentId_1 = 0;
		Integer facultyresearchtostudent_facultyId_1 = 0;
		Integer related_facultyresearch_facultyResearchId = 0;
		Facultyresearchtostudent response = null;
		response = service.deleteFacultyresearchtostudentFacultyresearch(facultyresearchtostudent_facultyResearchId_1, facultyresearchtostudent_studentId_1, facultyresearchtostudent_facultyId_1, related_facultyresearch_facultyResearchId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyresearchtostudentFacultyresearch
	}

	/**
	 * Operation Unit Test
	 * Return a count of all Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void countFacultyresearchtostudents() {
		Integer response = null;
		response = service.countFacultyresearchtostudents();
		// TODO: JUnit - Add assertions to test outputs of operation: countFacultyresearchtostudents
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteFacultyresearchtostudentFaculty() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyresearchtostudentFaculty 
		Integer facultyresearchtostudent_facultyResearchId_2 = 0;
		Integer facultyresearchtostudent_studentId_2 = 0;
		Integer facultyresearchtostudent_facultyId_2 = 0;
		Integer related_faculty_facultyId = 0;
		Facultyresearchtostudent response = null;
		response = service.deleteFacultyresearchtostudentFaculty(facultyresearchtostudent_facultyResearchId_2, facultyresearchtostudent_studentId_2, facultyresearchtostudent_facultyId_2, related_faculty_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyresearchtostudentFaculty
	}

	/**
	 * Operation Unit Test
	 * Return all Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void findAllFacultyresearchtostudents() {
		// TODO: JUnit - Populate test inputs for operation: findAllFacultyresearchtostudents 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<Facultyresearchtostudent> response = null;
		response = service.findAllFacultyresearchtostudents(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllFacultyresearchtostudents
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveFacultyresearchtostudentFaculty() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyresearchtostudentFaculty 
		Integer facultyResearchId = 0;
		Integer studentId = 0;
		Integer facultyId = 0;
		Faculty related_faculty = new edu.unf.cen6940.domain.Faculty();
		Facultyresearchtostudent response = null;
		response = service.saveFacultyresearchtostudentFaculty(facultyResearchId, studentId, facultyId, related_faculty);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyresearchtostudentFaculty
	}

	/**
	 * Operation Unit Test
	 * Save an existing Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void saveFacultyresearchtostudent() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyresearchtostudent 
		Facultyresearchtostudent facultyresearchtostudent = new edu.unf.cen6940.domain.Facultyresearchtostudent();
		service.saveFacultyresearchtostudent(facultyresearchtostudent);
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findFacultyresearchtostudentByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findFacultyresearchtostudentByPrimaryKey 
		Integer facultyResearchId_1 = 0;
		Integer studentId_1 = 0;
		Integer facultyId_1 = 0;
		Facultyresearchtostudent response = null;
		response = service.findFacultyresearchtostudentByPrimaryKey(facultyResearchId_1, studentId_1, facultyId_1);
		// TODO: JUnit - Add assertions to test outputs of operation: findFacultyresearchtostudentByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Save an existing Student entity
	 * 
	 */
	@Test
	public void saveFacultyresearchtostudentStudent() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyresearchtostudentStudent 
		Integer facultyResearchId_2 = 0;
		Integer studentId_2 = 0;
		Integer facultyId_2 = 0;
		Student related_student = new edu.unf.cen6940.domain.Student();
		Facultyresearchtostudent response = null;
		response = service.saveFacultyresearchtostudentStudent(facultyResearchId_2, studentId_2, facultyId_2, related_student);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyresearchtostudentStudent
	}

	/**
	 * Operation Unit Test
	 * Load an existing Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void loadFacultyresearchtostudents() {
		Set<Facultyresearchtostudent> response = null;
		response = service.loadFacultyresearchtostudents();
		// TODO: JUnit - Add assertions to test outputs of operation: loadFacultyresearchtostudents
	}

	/**
	 * Operation Unit Test
	 * Save an existing Facultyresearch entity
	 * 
	 */
	@Test
	public void saveFacultyresearchtostudentFacultyresearch() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyresearchtostudentFacultyresearch 
		Integer facultyResearchId_3 = 0;
		Integer studentId_3 = 0;
		Integer facultyId_3 = 0;
		Facultyresearch related_facultyresearch = new edu.unf.cen6940.domain.Facultyresearch();
		Facultyresearchtostudent response = null;
		response = service.saveFacultyresearchtostudentFacultyresearch(facultyResearchId_3, studentId_3, facultyId_3, related_facultyresearch);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyresearchtostudentFacultyresearch
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void deleteFacultyresearchtostudent() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyresearchtostudent 
		Facultyresearchtostudent facultyresearchtostudent_1 = new edu.unf.cen6940.domain.Facultyresearchtostudent();
		service.deleteFacultyresearchtostudent(facultyresearchtostudent_1);
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
